// import interface.
#include <windows.h>
#include <stdio.h>
#include <assert.h>

int main(int argc, char* argv[]) {
	if (argc != 2) {
		printf("Usage: %s file\n", argv[0]);
		return 0;
	}

	{
		FILE* pf;
		pf = fopen(argv[1], "rb");
		if (pf == NULL) {
			printf("file \'%s\' do not exist.\n", argv[1]);
			return 0;
		}

		while (1) {
			size_t rsize;
			char buf[16];
			rsize = fread(buf, sizeof(char), 16, pf);
			if (rsize != 0) {
				size_t i;
				for (i = 0; i < rsize; ++i) {
					printf("%02x ", (unsigned char)buf[i]);
				}
				printf("\n");
			} else {
				if (feof(pf)) {
					printf("end of file.\n");
				} else {
					printf("not end of file.\n");
				}
				break;
			}
		}
		fclose(pf);
	}
	return 0;
}
